// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate gtype;
extern crate iam_v1;
extern crate lazy_static;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Audit log information specific to Cloud IAM admin APIs. This message is
/// serialized as an `Any` type in the `ServiceData` message of an
/// `AuditLog` message.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AuditData {
    /// The permission_delta when when creating or updating a Role.
    pub permission_delta: std::option::Option<crate::model::audit_data::PermissionDelta>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AuditData {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [permission_delta][crate::model::AuditData::permission_delta].
    pub fn set_permission_delta<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::audit_data::PermissionDelta>,
    {
        self.permission_delta = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [permission_delta][crate::model::AuditData::permission_delta].
    pub fn set_or_clear_permission_delta<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::audit_data::PermissionDelta>,
    {
        self.permission_delta = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for AuditData {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.AuditData"
    }
}

/// Defines additional types related to [AuditData].
pub mod audit_data {
    #[allow(unused_imports)]
    use super::*;

    /// A PermissionDelta message to record the added_permissions and
    /// removed_permissions inside a role.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct PermissionDelta {
        /// Added permissions.
        pub added_permissions: std::vec::Vec<std::string::String>,

        /// Removed permissions.
        pub removed_permissions: std::vec::Vec<std::string::String>,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl PermissionDelta {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [added_permissions][crate::model::audit_data::PermissionDelta::added_permissions].
        pub fn set_added_permissions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.added_permissions = v.into_iter().map(|i| i.into()).collect();
            self
        }

        /// Sets the value of [removed_permissions][crate::model::audit_data::PermissionDelta::removed_permissions].
        pub fn set_removed_permissions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.removed_permissions = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    impl wkt::message::Message for PermissionDelta {
        fn typename() -> &'static str {
            "type.googleapis.com/google.iam.admin.v1.AuditData.PermissionDelta"
        }
    }
}

/// An IAM service account.
///
/// A service account is an account for an application or a virtual machine (VM)
/// instance, not a person. You can use a service account to call Google APIs. To
/// learn more, read the [overview of service
/// accounts](https://cloud.google.com/iam/help/service-accounts/overview).
///
/// When you create a service account, you specify the project ID that owns the
/// service account, as well as a name that must be unique within the project.
/// IAM uses these values to create an email address that identifies the service
/// account.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceAccount {
    /// The resource name of the service account.
    ///
    /// Use one of the following formats:
    ///
    /// * `projects/{PROJECT_ID}/serviceAccounts/{EMAIL_ADDRESS}`
    /// * `projects/{PROJECT_ID}/serviceAccounts/{UNIQUE_ID}`
    ///
    /// As an alternative, you can use the `-` wildcard character instead of the
    /// project ID:
    ///
    /// * `projects/-/serviceAccounts/{EMAIL_ADDRESS}`
    /// * `projects/-/serviceAccounts/{UNIQUE_ID}`
    ///
    /// When possible, avoid using the `-` wildcard character, because it can cause
    /// response messages to contain misleading error codes. For example, if you
    /// try to get the service account
    /// `projects/-/serviceAccounts/fake@example.com`, which does not exist, the
    /// response contains an HTTP `403 Forbidden` error instead of a `404 Not
    /// Found` error.
    pub name: std::string::String,

    /// Output only. The ID of the project that owns the service account.
    pub project_id: std::string::String,

    /// Output only. The unique, stable numeric ID for the service account.
    ///
    /// Each service account retains its unique ID even if you delete the service
    /// account. For example, if you delete a service account, then create a new
    /// service account with the same name, the new service account has a different
    /// unique ID than the deleted service account.
    pub unique_id: std::string::String,

    /// Output only. The email address of the service account.
    pub email: std::string::String,

    /// Optional. A user-specified, human-readable name for the service account. The maximum
    /// length is 100 UTF-8 bytes.
    pub display_name: std::string::String,

    /// Deprecated. Do not use.
    #[deprecated]
    pub etag: ::bytes::Bytes,

    /// Optional. A user-specified, human-readable description of the service account. The
    /// maximum length is 256 UTF-8 bytes.
    pub description: std::string::String,

    /// Output only. The OAuth 2.0 client ID for the service account.
    pub oauth2_client_id: std::string::String,

    /// Output only. Whether the service account is disabled.
    pub disabled: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ServiceAccount {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ServiceAccount::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [project_id][crate::model::ServiceAccount::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [unique_id][crate::model::ServiceAccount::unique_id].
    pub fn set_unique_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.unique_id = v.into();
        self
    }

    /// Sets the value of [email][crate::model::ServiceAccount::email].
    pub fn set_email<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.email = v.into();
        self
    }

    /// Sets the value of [display_name][crate::model::ServiceAccount::display_name].
    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.display_name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::ServiceAccount::etag].
    #[deprecated]
    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [description][crate::model::ServiceAccount::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [oauth2_client_id][crate::model::ServiceAccount::oauth2_client_id].
    pub fn set_oauth2_client_id<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.oauth2_client_id = v.into();
        self
    }

    /// Sets the value of [disabled][crate::model::ServiceAccount::disabled].
    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.disabled = v.into();
        self
    }
}

impl wkt::message::Message for ServiceAccount {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ServiceAccount"
    }
}

/// The service account create request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateServiceAccountRequest {
    /// Required. The resource name of the project associated with the service
    /// accounts, such as `projects/my-project-123`.
    pub name: std::string::String,

    /// Required. The account id that is used to generate the service account
    /// email address and a stable unique id. It is unique within a project,
    /// must be 6-30 characters long, and match the regular expression
    /// `[a-z]([-a-z0-9]*[a-z0-9])` to comply with RFC1035.
    pub account_id: std::string::String,

    /// The [ServiceAccount][google.iam.admin.v1.ServiceAccount] resource to
    /// create. Currently, only the following values are user assignable:
    /// `display_name` and `description`.
    ///
    /// [google.iam.admin.v1.ServiceAccount]: crate::model::ServiceAccount
    pub service_account: std::option::Option<crate::model::ServiceAccount>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateServiceAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::CreateServiceAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [account_id][crate::model::CreateServiceAccountRequest::account_id].
    pub fn set_account_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.account_id = v.into();
        self
    }

    /// Sets the value of [service_account][crate::model::CreateServiceAccountRequest::service_account].
    pub fn set_service_account<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceAccount>,
    {
        self.service_account = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_account][crate::model::CreateServiceAccountRequest::service_account].
    pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceAccount>,
    {
        self.service_account = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateServiceAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.CreateServiceAccountRequest"
    }
}

/// The service account list request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceAccountsRequest {
    /// Required. The resource name of the project associated with the service
    /// accounts, such as `projects/my-project-123`.
    pub name: std::string::String,

    /// Optional limit on the number of service accounts to include in the
    /// response. Further accounts can subsequently be obtained by including the
    /// [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]
    /// in a subsequent request.
    ///
    /// The default is 20, and the maximum is 100.
    ///
    /// [google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]: crate::model::ListServiceAccountsResponse::next_page_token
    pub page_size: i32,

    /// Optional pagination token returned in an earlier
    /// [ListServiceAccountsResponse.next_page_token][google.iam.admin.v1.ListServiceAccountsResponse.next_page_token].
    ///
    /// [google.iam.admin.v1.ListServiceAccountsResponse.next_page_token]: crate::model::ListServiceAccountsResponse::next_page_token
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceAccountsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ListServiceAccountsRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListServiceAccountsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListServiceAccountsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServiceAccountsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountsRequest"
    }
}

/// The service account list response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceAccountsResponse {
    /// The list of matching service accounts.
    pub accounts: std::vec::Vec<crate::model::ServiceAccount>,

    /// To retrieve the next page of results, set
    /// [ListServiceAccountsRequest.page_token][google.iam.admin.v1.ListServiceAccountsRequest.page_token]
    /// to this value.
    ///
    /// [google.iam.admin.v1.ListServiceAccountsRequest.page_token]: crate::model::ListServiceAccountsRequest::page_token
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceAccountsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [accounts][crate::model::ListServiceAccountsResponse::accounts].
    pub fn set_accounts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ServiceAccount>,
    {
        use std::iter::Iterator;
        self.accounts = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListServiceAccountsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListServiceAccountsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListServiceAccountsResponse {
    type PageItem = crate::model::ServiceAccount;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.accounts
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The service account get request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServiceAccountRequest {
    /// Required. The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetServiceAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetServiceAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetServiceAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.GetServiceAccountRequest"
    }
}

/// The service account delete request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteServiceAccountRequest {
    /// Required. The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteServiceAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteServiceAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteServiceAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.DeleteServiceAccountRequest"
    }
}

/// The service account patch request.
///
/// You can patch only the `display_name` and `description` fields. You must use
/// the `update_mask` field to specify which of these fields you want to patch.
///
/// Only the fields specified in the request are guaranteed to be returned in
/// the response. Other fields may be empty in the response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PatchServiceAccountRequest {
    pub service_account: std::option::Option<crate::model::ServiceAccount>,

    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl PatchServiceAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [service_account][crate::model::PatchServiceAccountRequest::service_account].
    pub fn set_service_account<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceAccount>,
    {
        self.service_account = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [service_account][crate::model::PatchServiceAccountRequest::service_account].
    pub fn set_or_clear_service_account<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceAccount>,
    {
        self.service_account = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::PatchServiceAccountRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::PatchServiceAccountRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for PatchServiceAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.PatchServiceAccountRequest"
    }
}

/// The service account undelete request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteServiceAccountRequest {
    /// The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_UNIQUE_ID}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteServiceAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UndeleteServiceAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for UndeleteServiceAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.UndeleteServiceAccountRequest"
    }
}

#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteServiceAccountResponse {
    /// Metadata for the restored service account.
    pub restored_account: std::option::Option<crate::model::ServiceAccount>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteServiceAccountResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [restored_account][crate::model::UndeleteServiceAccountResponse::restored_account].
    pub fn set_restored_account<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::ServiceAccount>,
    {
        self.restored_account = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [restored_account][crate::model::UndeleteServiceAccountResponse::restored_account].
    pub fn set_or_clear_restored_account<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::ServiceAccount>,
    {
        self.restored_account = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UndeleteServiceAccountResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.UndeleteServiceAccountResponse"
    }
}

/// The service account enable request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnableServiceAccountRequest {
    /// The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EnableServiceAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::EnableServiceAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for EnableServiceAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.EnableServiceAccountRequest"
    }
}

/// The service account disable request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DisableServiceAccountRequest {
    /// The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DisableServiceAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DisableServiceAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DisableServiceAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.DisableServiceAccountRequest"
    }
}

/// The service account keys list request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceAccountKeysRequest {
    /// Required. The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    ///
    /// Using `-` as a wildcard for the `PROJECT_ID`, will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    /// Filters the types of keys the user wants to include in the list
    /// response. Duplicate key types are not allowed. If no key type
    /// is provided, all keys are returned.
    pub key_types: std::vec::Vec<crate::model::list_service_account_keys_request::KeyType>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceAccountKeysRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ListServiceAccountKeysRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [key_types][crate::model::ListServiceAccountKeysRequest::key_types].
    pub fn set_key_types<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::list_service_account_keys_request::KeyType>,
    {
        use std::iter::Iterator;
        self.key_types = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListServiceAccountKeysRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountKeysRequest"
    }
}

/// Defines additional types related to [ListServiceAccountKeysRequest].
pub mod list_service_account_keys_request {
    #[allow(unused_imports)]
    use super::*;

    /// `KeyType` filters to selectively retrieve certain varieties
    /// of keys.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum KeyType {
        /// Unspecified key type. The presence of this in the
        /// message will immediately result in an error.
        Unspecified,
        /// User-managed keys (managed and rotated by the user).
        UserManaged,
        /// System-managed keys (managed and rotated by Google).
        SystemManaged,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [KeyType::value] or
        /// [KeyType::name].
        UnknownValue(key_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod key_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl KeyType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::UserManaged => std::option::Option::Some(1),
                Self::SystemManaged => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("KEY_TYPE_UNSPECIFIED"),
                Self::UserManaged => std::option::Option::Some("USER_MANAGED"),
                Self::SystemManaged => std::option::Option::Some("SYSTEM_MANAGED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for KeyType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for KeyType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for KeyType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::UserManaged,
                2 => Self::SystemManaged,
                _ => Self::UnknownValue(key_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for KeyType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "KEY_TYPE_UNSPECIFIED" => Self::Unspecified,
                "USER_MANAGED" => Self::UserManaged,
                "SYSTEM_MANAGED" => Self::SystemManaged,
                _ => Self::UnknownValue(key_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for KeyType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::UserManaged => serializer.serialize_i32(1),
                Self::SystemManaged => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for KeyType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyType>::new(
                ".google.iam.admin.v1.ListServiceAccountKeysRequest.KeyType",
            ))
        }
    }
}

/// The service account keys list response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListServiceAccountKeysResponse {
    /// The public keys for the service account.
    pub keys: std::vec::Vec<crate::model::ServiceAccountKey>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListServiceAccountKeysResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [keys][crate::model::ListServiceAccountKeysResponse::keys].
    pub fn set_keys<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::ServiceAccountKey>,
    {
        use std::iter::Iterator;
        self.keys = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ListServiceAccountKeysResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ListServiceAccountKeysResponse"
    }
}

/// The service account key get by id request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetServiceAccountKeyRequest {
    /// Required. The resource name of the service account key in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
    ///
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    /// Optional. The output format of the public key. The default is `TYPE_NONE`, which
    /// means that the public key is not returned.
    pub public_key_type: crate::model::ServiceAccountPublicKeyType,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetServiceAccountKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetServiceAccountKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [public_key_type][crate::model::GetServiceAccountKeyRequest::public_key_type].
    pub fn set_public_key_type<T: std::convert::Into<crate::model::ServiceAccountPublicKeyType>>(
        mut self,
        v: T,
    ) -> Self {
        self.public_key_type = v.into();
        self
    }
}

impl wkt::message::Message for GetServiceAccountKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.GetServiceAccountKeyRequest"
    }
}

/// Represents a service account key.
///
/// A service account has two sets of key-pairs: user-managed, and
/// system-managed.
///
/// User-managed key-pairs can be created and deleted by users.  Users are
/// responsible for rotating these keys periodically to ensure security of
/// their service accounts.  Users retain the private key of these key-pairs,
/// and Google retains ONLY the public key.
///
/// System-managed keys are automatically rotated by Google, and are used for
/// signing for a maximum of two weeks. The rotation process is probabilistic,
/// and usage of the new key will gradually ramp up and down over the key's
/// lifetime.
///
/// If you cache the public key set for a service account, we recommend that you
/// update the cache every 15 minutes. User-managed keys can be added and removed
/// at any time, so it is important to update the cache frequently. For
/// Google-managed keys, Google will publish a key at least 6 hours before it is
/// first used for signing and will keep publishing it for at least 6 hours after
/// it was last used for signing.
///
/// Public keys for all service accounts are also published at the OAuth2
/// Service Account API.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ServiceAccountKey {
    /// The resource name of the service account key in the following format
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
    pub name: std::string::String,

    /// The output format for the private key.
    /// Only provided in `CreateServiceAccountKey` responses, not
    /// in `GetServiceAccountKey` or `ListServiceAccountKey` responses.
    ///
    /// Google never exposes system-managed private keys, and never retains
    /// user-managed private keys.
    pub private_key_type: crate::model::ServiceAccountPrivateKeyType,

    /// Specifies the algorithm (and possibly key size) for the key.
    pub key_algorithm: crate::model::ServiceAccountKeyAlgorithm,

    /// The private key data. Only provided in `CreateServiceAccountKey`
    /// responses. Make sure to keep the private key data secure because it
    /// allows for the assertion of the service account identity.
    /// When base64 decoded, the private key data can be used to authenticate with
    /// Google API client libraries and with
    /// <a href="/sdk/gcloud/reference/auth/activate-service-account">gcloud
    /// auth activate-service-account</a>.
    pub private_key_data: ::bytes::Bytes,

    /// The public key data. Only provided in `GetServiceAccountKey` responses.
    pub public_key_data: ::bytes::Bytes,

    /// The key can be used after this timestamp.
    pub valid_after_time: std::option::Option<wkt::Timestamp>,

    /// The key can be used before this timestamp.
    /// For system-managed key pairs, this timestamp is the end time for the
    /// private key signing operation. The public key could still be used
    /// for verification for a few hours after this time.
    pub valid_before_time: std::option::Option<wkt::Timestamp>,

    /// The key origin.
    pub key_origin: crate::model::ServiceAccountKeyOrigin,

    /// The key type.
    pub key_type: crate::model::list_service_account_keys_request::KeyType,

    /// The key status.
    pub disabled: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ServiceAccountKey {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::ServiceAccountKey::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [private_key_type][crate::model::ServiceAccountKey::private_key_type].
    pub fn set_private_key_type<
        T: std::convert::Into<crate::model::ServiceAccountPrivateKeyType>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.private_key_type = v.into();
        self
    }

    /// Sets the value of [key_algorithm][crate::model::ServiceAccountKey::key_algorithm].
    pub fn set_key_algorithm<T: std::convert::Into<crate::model::ServiceAccountKeyAlgorithm>>(
        mut self,
        v: T,
    ) -> Self {
        self.key_algorithm = v.into();
        self
    }

    /// Sets the value of [private_key_data][crate::model::ServiceAccountKey::private_key_data].
    pub fn set_private_key_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.private_key_data = v.into();
        self
    }

    /// Sets the value of [public_key_data][crate::model::ServiceAccountKey::public_key_data].
    pub fn set_public_key_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.public_key_data = v.into();
        self
    }

    /// Sets the value of [valid_after_time][crate::model::ServiceAccountKey::valid_after_time].
    pub fn set_valid_after_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.valid_after_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [valid_after_time][crate::model::ServiceAccountKey::valid_after_time].
    pub fn set_or_clear_valid_after_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.valid_after_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [valid_before_time][crate::model::ServiceAccountKey::valid_before_time].
    pub fn set_valid_before_time<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.valid_before_time = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [valid_before_time][crate::model::ServiceAccountKey::valid_before_time].
    pub fn set_or_clear_valid_before_time<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::Timestamp>,
    {
        self.valid_before_time = v.map(|x| x.into());
        self
    }

    /// Sets the value of [key_origin][crate::model::ServiceAccountKey::key_origin].
    pub fn set_key_origin<T: std::convert::Into<crate::model::ServiceAccountKeyOrigin>>(
        mut self,
        v: T,
    ) -> Self {
        self.key_origin = v.into();
        self
    }

    /// Sets the value of [key_type][crate::model::ServiceAccountKey::key_type].
    pub fn set_key_type<
        T: std::convert::Into<crate::model::list_service_account_keys_request::KeyType>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.key_type = v.into();
        self
    }

    /// Sets the value of [disabled][crate::model::ServiceAccountKey::disabled].
    pub fn set_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.disabled = v.into();
        self
    }
}

impl wkt::message::Message for ServiceAccountKey {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ServiceAccountKey"
    }
}

/// The service account key create request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateServiceAccountKeyRequest {
    /// Required. The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    /// The output format of the private key. The default value is
    /// `TYPE_GOOGLE_CREDENTIALS_FILE`, which is the Google Credentials File
    /// format.
    pub private_key_type: crate::model::ServiceAccountPrivateKeyType,

    /// Which type of key and algorithm to use for the key.
    /// The default is currently a 2K RSA key.  However this may change in the
    /// future.
    pub key_algorithm: crate::model::ServiceAccountKeyAlgorithm,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateServiceAccountKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::CreateServiceAccountKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [private_key_type][crate::model::CreateServiceAccountKeyRequest::private_key_type].
    pub fn set_private_key_type<
        T: std::convert::Into<crate::model::ServiceAccountPrivateKeyType>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.private_key_type = v.into();
        self
    }

    /// Sets the value of [key_algorithm][crate::model::CreateServiceAccountKeyRequest::key_algorithm].
    pub fn set_key_algorithm<T: std::convert::Into<crate::model::ServiceAccountKeyAlgorithm>>(
        mut self,
        v: T,
    ) -> Self {
        self.key_algorithm = v.into();
        self
    }
}

impl wkt::message::Message for CreateServiceAccountKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.CreateServiceAccountKeyRequest"
    }
}

/// The service account key upload request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UploadServiceAccountKeyRequest {
    /// The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    /// The public key to associate with the service account. Must be an RSA public
    /// key that is wrapped in an X.509 v3 certificate. Include the first line,
    /// `-----BEGIN CERTIFICATE-----`, and the last line,
    /// `-----END CERTIFICATE-----`.
    pub public_key_data: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UploadServiceAccountKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UploadServiceAccountKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [public_key_data][crate::model::UploadServiceAccountKeyRequest::public_key_data].
    pub fn set_public_key_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.public_key_data = v.into();
        self
    }
}

impl wkt::message::Message for UploadServiceAccountKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.UploadServiceAccountKeyRequest"
    }
}

/// The service account key delete request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteServiceAccountKeyRequest {
    /// Required. The resource name of the service account key in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteServiceAccountKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteServiceAccountKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteServiceAccountKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.DeleteServiceAccountKeyRequest"
    }
}

/// The service account key disable request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DisableServiceAccountKeyRequest {
    /// Required. The resource name of the service account key in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
    ///
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DisableServiceAccountKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DisableServiceAccountKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DisableServiceAccountKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.DisableServiceAccountKeyRequest"
    }
}

/// The service account key enable request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct EnableServiceAccountKeyRequest {
    /// Required. The resource name of the service account key in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}/keys/{key}`.
    ///
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl EnableServiceAccountKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::EnableServiceAccountKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for EnableServiceAccountKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.EnableServiceAccountKeyRequest"
    }
}

/// Deprecated. [Migrate to Service Account Credentials
/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
///
/// The service account sign blob request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SignBlobRequest {
    /// Required. Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    #[deprecated]
    pub name: std::string::String,

    /// Required. Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The bytes to sign.
    #[deprecated]
    pub bytes_to_sign: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SignBlobRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SignBlobRequest::name].
    #[deprecated]
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [bytes_to_sign][crate::model::SignBlobRequest::bytes_to_sign].
    #[deprecated]
    pub fn set_bytes_to_sign<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.bytes_to_sign = v.into();
        self
    }
}

impl wkt::message::Message for SignBlobRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.SignBlobRequest"
    }
}

/// Deprecated. [Migrate to Service Account Credentials
/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
///
/// The service account sign blob response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SignBlobResponse {
    /// Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The id of the key used to sign the blob.
    #[deprecated]
    pub key_id: std::string::String,

    /// Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The signed blob.
    #[deprecated]
    pub signature: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SignBlobResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [key_id][crate::model::SignBlobResponse::key_id].
    #[deprecated]
    pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.key_id = v.into();
        self
    }

    /// Sets the value of [signature][crate::model::SignBlobResponse::signature].
    #[deprecated]
    pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.signature = v.into();
        self
    }
}

impl wkt::message::Message for SignBlobResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.SignBlobResponse"
    }
}

/// Deprecated. [Migrate to Service Account Credentials
/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
///
/// The service account sign JWT request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SignJwtRequest {
    /// Required. Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The resource name of the service account in the following format:
    /// `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
    /// Using `-` as a wildcard for the `PROJECT_ID` will infer the project from
    /// the account. The `ACCOUNT` value can be the `email` address or the
    /// `unique_id` of the service account.
    #[deprecated]
    pub name: std::string::String,

    /// Required. Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The JWT payload to sign. Must be a serialized JSON object that contains a
    /// JWT Claims Set. For example: `{"sub": "user@example.com", "iat": 313435}`
    ///
    /// If the JWT Claims Set contains an expiration time (`exp`) claim, it must be
    /// an integer timestamp that is not in the past and no more than 12 hours in
    /// the future.
    ///
    /// If the JWT Claims Set does not contain an expiration time (`exp`) claim,
    /// this claim is added automatically, with a timestamp that is 1 hour in the
    /// future.
    #[deprecated]
    pub payload: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SignJwtRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::SignJwtRequest::name].
    #[deprecated]
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [payload][crate::model::SignJwtRequest::payload].
    #[deprecated]
    pub fn set_payload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.payload = v.into();
        self
    }
}

impl wkt::message::Message for SignJwtRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.SignJwtRequest"
    }
}

/// Deprecated. [Migrate to Service Account Credentials
/// API](https://cloud.google.com/iam/help/credentials/migrate-api).
///
/// The service account sign JWT response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SignJwtResponse {
    /// Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The id of the key used to sign the JWT.
    #[deprecated]
    pub key_id: std::string::String,

    /// Deprecated. [Migrate to Service Account Credentials
    /// API](https://cloud.google.com/iam/help/credentials/migrate-api).
    ///
    /// The signed JWT.
    #[deprecated]
    pub signed_jwt: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl SignJwtResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [key_id][crate::model::SignJwtResponse::key_id].
    #[deprecated]
    pub fn set_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.key_id = v.into();
        self
    }

    /// Sets the value of [signed_jwt][crate::model::SignJwtResponse::signed_jwt].
    #[deprecated]
    pub fn set_signed_jwt<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.signed_jwt = v.into();
        self
    }
}

impl wkt::message::Message for SignJwtResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.SignJwtResponse"
    }
}

/// A role in the Identity and Access Management API.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Role {
    /// The name of the role.
    ///
    /// When Role is used in CreateRole, the role name must not be set.
    ///
    /// When Role is used in output and other input such as UpdateRole, the role
    /// name is the complete path, e.g., roles/logging.viewer for predefined roles
    /// and organizations/{ORGANIZATION_ID}/roles/logging.viewer for custom roles.
    pub name: std::string::String,

    /// Optional. A human-readable title for the role.  Typically this
    /// is limited to 100 UTF-8 bytes.
    pub title: std::string::String,

    /// Optional. A human-readable description for the role.
    pub description: std::string::String,

    /// The names of the permissions this role grants when bound in an IAM policy.
    pub included_permissions: std::vec::Vec<std::string::String>,

    /// The current launch stage of the role. If the `ALPHA` launch stage has been
    /// selected for a role, the `stage` field will not be included in the
    /// returned definition for the role.
    pub stage: crate::model::role::RoleLaunchStage,

    /// Used to perform a consistent read-modify-write.
    pub etag: ::bytes::Bytes,

    /// The current deleted state of the role. This field is read only.
    /// It will be ignored in calls to CreateRole and UpdateRole.
    pub deleted: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Role {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Role::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [title][crate::model::Role::title].
    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.title = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Role::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [included_permissions][crate::model::Role::included_permissions].
    pub fn set_included_permissions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.included_permissions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [stage][crate::model::Role::stage].
    pub fn set_stage<T: std::convert::Into<crate::model::role::RoleLaunchStage>>(
        mut self,
        v: T,
    ) -> Self {
        self.stage = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::Role::etag].
    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }

    /// Sets the value of [deleted][crate::model::Role::deleted].
    pub fn set_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.deleted = v.into();
        self
    }
}

impl wkt::message::Message for Role {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.Role"
    }
}

/// Defines additional types related to [Role].
pub mod role {
    #[allow(unused_imports)]
    use super::*;

    /// A stage representing a role's lifecycle phase.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum RoleLaunchStage {
        /// The user has indicated this role is currently in an Alpha phase. If this
        /// launch stage is selected, the `stage` field will not be included when
        /// requesting the definition for a given role.
        Alpha,
        /// The user has indicated this role is currently in a Beta phase.
        Beta,
        /// The user has indicated this role is generally available.
        Ga,
        /// The user has indicated this role is being deprecated.
        Deprecated,
        /// This role is disabled and will not contribute permissions to any
        /// principals it is granted to in policies.
        Disabled,
        /// The user has indicated this role is currently in an EAP phase.
        Eap,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [RoleLaunchStage::value] or
        /// [RoleLaunchStage::name].
        UnknownValue(role_launch_stage::UnknownValue),
    }

    #[doc(hidden)]
    pub mod role_launch_stage {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl RoleLaunchStage {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Alpha => std::option::Option::Some(0),
                Self::Beta => std::option::Option::Some(1),
                Self::Ga => std::option::Option::Some(2),
                Self::Deprecated => std::option::Option::Some(4),
                Self::Disabled => std::option::Option::Some(5),
                Self::Eap => std::option::Option::Some(6),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Alpha => std::option::Option::Some("ALPHA"),
                Self::Beta => std::option::Option::Some("BETA"),
                Self::Ga => std::option::Option::Some("GA"),
                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
                Self::Disabled => std::option::Option::Some("DISABLED"),
                Self::Eap => std::option::Option::Some("EAP"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for RoleLaunchStage {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for RoleLaunchStage {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for RoleLaunchStage {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Alpha,
                1 => Self::Beta,
                2 => Self::Ga,
                4 => Self::Deprecated,
                5 => Self::Disabled,
                6 => Self::Eap,
                _ => Self::UnknownValue(role_launch_stage::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for RoleLaunchStage {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ALPHA" => Self::Alpha,
                "BETA" => Self::Beta,
                "GA" => Self::Ga,
                "DEPRECATED" => Self::Deprecated,
                "DISABLED" => Self::Disabled,
                "EAP" => Self::Eap,
                _ => Self::UnknownValue(role_launch_stage::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for RoleLaunchStage {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Alpha => serializer.serialize_i32(0),
                Self::Beta => serializer.serialize_i32(1),
                Self::Ga => serializer.serialize_i32(2),
                Self::Deprecated => serializer.serialize_i32(4),
                Self::Disabled => serializer.serialize_i32(5),
                Self::Eap => serializer.serialize_i32(6),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for RoleLaunchStage {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoleLaunchStage>::new(
                ".google.iam.admin.v1.Role.RoleLaunchStage",
            ))
        }
    }
}

/// The grantable role query request.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryGrantableRolesRequest {
    /// Required. The full resource name to query from the list of grantable roles.
    ///
    /// The name follows the Google Cloud Platform resource format.
    /// For example, a Cloud Platform project with id `my-project` will be named
    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
    pub full_resource_name: std::string::String,

    pub view: crate::model::RoleView,

    /// Optional limit on the number of roles to include in the response.
    ///
    /// The default is 300, and the maximum is 1,000.
    pub page_size: i32,

    /// Optional pagination token returned in an earlier
    /// QueryGrantableRolesResponse.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryGrantableRolesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [full_resource_name][crate::model::QueryGrantableRolesRequest::full_resource_name].
    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.full_resource_name = v.into();
        self
    }

    /// Sets the value of [view][crate::model::QueryGrantableRolesRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::RoleView>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::QueryGrantableRolesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::QueryGrantableRolesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for QueryGrantableRolesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.QueryGrantableRolesRequest"
    }
}

/// The grantable role query response.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryGrantableRolesResponse {
    /// The list of matching roles.
    pub roles: std::vec::Vec<crate::model::Role>,

    /// To retrieve the next page of results, set
    /// `QueryGrantableRolesRequest.page_token` to this value.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryGrantableRolesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [roles][crate::model::QueryGrantableRolesResponse::roles].
    pub fn set_roles<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Role>,
    {
        use std::iter::Iterator;
        self.roles = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::QueryGrantableRolesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for QueryGrantableRolesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.QueryGrantableRolesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for QueryGrantableRolesResponse {
    type PageItem = crate::model::Role;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.roles
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request to get all roles defined under a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRolesRequest {
    /// The `parent` parameter's value depends on the target resource for the
    /// request, namely
    /// [`roles`](https://cloud.google.com/iam/reference/rest/v1/roles),
    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles),
    /// or
    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
    /// Each resource type's `parent` value format is described below:
    ///
    /// * [`roles.list()`](https://cloud.google.com/iam/reference/rest/v1/roles/list): An empty string.
    ///   This method doesn't require a resource; it simply returns all
    ///   [predefined
    ///   roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles)
    ///   in Cloud IAM. Example request URL: `<https://iam.googleapis.com/v1/roles>`
    ///
    /// * [`projects.roles.list()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/list):
    ///   `projects/{PROJECT_ID}`. This method lists all project-level
    ///   [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
    ///   Example request URL:
    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles>`
    ///
    /// * [`organizations.roles.list()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/list):
    ///   `organizations/{ORGANIZATION_ID}`. This method lists all
    ///   organization-level [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
    ///   Example request URL:
    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles>`
    ///
    ///
    /// Note: Wildcard (*) values are invalid; you must specify a complete project
    /// ID or organization ID.
    pub parent: std::string::String,

    /// Optional limit on the number of roles to include in the response.
    ///
    /// The default is 300, and the maximum is 1,000.
    pub page_size: i32,

    /// Optional pagination token returned in an earlier ListRolesResponse.
    pub page_token: std::string::String,

    /// Optional view for the returned Role objects. When `FULL` is specified,
    /// the `includedPermissions` field is returned, which includes a list of all
    /// permissions in the role. The default value is `BASIC`, which does not
    /// return the `includedPermissions` field.
    pub view: crate::model::RoleView,

    /// Include Roles that have been deleted.
    pub show_deleted: bool,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRolesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ListRolesRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::ListRolesRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::ListRolesRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }

    /// Sets the value of [view][crate::model::ListRolesRequest::view].
    pub fn set_view<T: std::convert::Into<crate::model::RoleView>>(mut self, v: T) -> Self {
        self.view = v.into();
        self
    }

    /// Sets the value of [show_deleted][crate::model::ListRolesRequest::show_deleted].
    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.show_deleted = v.into();
        self
    }
}

impl wkt::message::Message for ListRolesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ListRolesRequest"
    }
}

/// The response containing the roles defined under a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListRolesResponse {
    /// The Roles defined on this resource.
    pub roles: std::vec::Vec<crate::model::Role>,

    /// To retrieve the next page of results, set
    /// `ListRolesRequest.page_token` to this value.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ListRolesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [roles][crate::model::ListRolesResponse::roles].
    pub fn set_roles<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Role>,
    {
        use std::iter::Iterator;
        self.roles = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::ListRolesResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for ListRolesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.ListRolesResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for ListRolesResponse {
    type PageItem = crate::model::Role;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.roles
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// The request to get the definition of an existing role.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetRoleRequest {
    /// The `name` parameter's value depends on the target resource for the
    /// request, namely
    /// [`roles`](https://cloud.google.com/iam/reference/rest/v1/roles),
    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles),
    /// or
    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
    /// Each resource type's `name` value format is described below:
    ///
    /// * [`roles.get()`](https://cloud.google.com/iam/reference/rest/v1/roles/get): `roles/{ROLE_NAME}`.
    ///   This method returns results from all
    ///   [predefined
    ///   roles](https://cloud.google.com/iam/docs/understanding-roles#predefined_roles)
    ///   in Cloud IAM. Example request URL:
    ///   `<https://iam.googleapis.com/v1/roles/{ROLE_NAME}>`
    ///
    /// * [`projects.roles.get()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/get):
    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only
    ///   [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the project level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    /// * [`organizations.roles.get()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/get):
    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
    ///   returns only [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the organization level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    ///
    /// Note: Wildcard (*) values are invalid; you must specify a complete project
    /// ID or organization ID.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetRoleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetRoleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetRoleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.GetRoleRequest"
    }
}

/// The request to create a new role.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateRoleRequest {
    /// The `parent` parameter's value depends on the target resource for the
    /// request, namely
    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
    /// or
    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
    /// Each resource type's `parent` value format is described below:
    ///
    /// * [`projects.roles.create()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/create):
    ///   `projects/{PROJECT_ID}`. This method creates project-level
    ///   [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
    ///   Example request URL:
    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles>`
    ///
    /// * [`organizations.roles.create()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/create):
    ///   `organizations/{ORGANIZATION_ID}`. This method creates organization-level
    ///   [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles).
    ///   Example request URL:
    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles>`
    ///
    ///
    /// Note: Wildcard (*) values are invalid; you must specify a complete project
    /// ID or organization ID.
    pub parent: std::string::String,

    /// The role ID to use for this role.
    ///
    /// A role ID may contain alphanumeric characters, underscores (`_`), and
    /// periods (`.`). It must contain a minimum of 3 characters and a maximum of
    /// 64 characters.
    pub role_id: std::string::String,

    /// The Role resource to create.
    pub role: std::option::Option<crate::model::Role>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateRoleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateRoleRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [role_id][crate::model::CreateRoleRequest::role_id].
    pub fn set_role_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.role_id = v.into();
        self
    }

    /// Sets the value of [role][crate::model::CreateRoleRequest::role].
    pub fn set_role<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Role>,
    {
        self.role = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [role][crate::model::CreateRoleRequest::role].
    pub fn set_or_clear_role<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Role>,
    {
        self.role = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateRoleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.CreateRoleRequest"
    }
}

/// The request to update a role.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateRoleRequest {
    /// The `name` parameter's value depends on the target resource for the
    /// request, namely
    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
    /// or
    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
    /// Each resource type's `name` value format is described below:
    ///
    /// * [`projects.roles.patch()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/patch):
    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates only
    ///   [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the project level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    /// * [`organizations.roles.patch()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/patch):
    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
    ///   updates only [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the organization level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    ///
    /// Note: Wildcard (*) values are invalid; you must specify a complete project
    /// ID or organization ID.
    pub name: std::string::String,

    /// The updated role.
    pub role: std::option::Option<crate::model::Role>,

    /// A mask describing which fields in the Role have changed.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateRoleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UpdateRoleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [role][crate::model::UpdateRoleRequest::role].
    pub fn set_role<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::Role>,
    {
        self.role = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [role][crate::model::UpdateRoleRequest::role].
    pub fn set_or_clear_role<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::Role>,
    {
        self.role = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateRoleRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateRoleRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateRoleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.UpdateRoleRequest"
    }
}

/// The request to delete an existing role.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteRoleRequest {
    /// The `name` parameter's value depends on the target resource for the
    /// request, namely
    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
    /// or
    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
    /// Each resource type's `name` value format is described below:
    ///
    /// * [`projects.roles.delete()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/delete):
    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes only
    ///   [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the project level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    /// * [`organizations.roles.delete()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/delete):
    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
    ///   deletes only [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the organization level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    ///
    /// Note: Wildcard (*) values are invalid; you must specify a complete project
    /// ID or organization ID.
    pub name: std::string::String,

    /// Used to perform a consistent read-modify-write.
    pub etag: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteRoleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteRoleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::DeleteRoleRequest::etag].
    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for DeleteRoleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.DeleteRoleRequest"
    }
}

/// The request to undelete an existing role.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UndeleteRoleRequest {
    /// The `name` parameter's value depends on the target resource for the
    /// request, namely
    /// [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
    /// or
    /// [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles).
    /// Each resource type's `name` value format is described below:
    ///
    /// * [`projects.roles.undelete()`](https://cloud.google.com/iam/reference/rest/v1/projects.roles/undelete):
    ///   `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method undeletes
    ///   only [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the project level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    /// * [`organizations.roles.undelete()`](https://cloud.google.com/iam/reference/rest/v1/organizations.roles/undelete):
    ///   `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
    ///   undeletes only [custom
    ///   roles](https://cloud.google.com/iam/docs/understanding-custom-roles) that
    ///   have been created at the organization level. Example request URL:
    ///   `<https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}>`
    ///
    ///
    /// Note: Wildcard (*) values are invalid; you must specify a complete project
    /// ID or organization ID.
    pub name: std::string::String,

    /// Used to perform a consistent read-modify-write.
    pub etag: ::bytes::Bytes,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UndeleteRoleRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UndeleteRoleRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [etag][crate::model::UndeleteRoleRequest::etag].
    pub fn set_etag<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
        self.etag = v.into();
        self
    }
}

impl wkt::message::Message for UndeleteRoleRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.UndeleteRoleRequest"
    }
}

/// A permission which can be included by a role.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Permission {
    /// The name of this Permission.
    pub name: std::string::String,

    /// The title of this Permission.
    pub title: std::string::String,

    /// A brief description of what this Permission is used for.
    /// This permission can ONLY be used in predefined roles.
    pub description: std::string::String,

    #[deprecated]
    pub only_in_predefined_roles: bool,

    /// The current launch stage of the permission.
    pub stage: crate::model::permission::PermissionLaunchStage,

    /// The current custom role support level.
    pub custom_roles_support_level: crate::model::permission::CustomRolesSupportLevel,

    /// The service API associated with the permission is not enabled.
    pub api_disabled: bool,

    /// The preferred name for this permission. If present, then this permission is
    /// an alias of, and equivalent to, the listed primary_permission.
    pub primary_permission: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl Permission {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::Permission::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [title][crate::model::Permission::title].
    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.title = v.into();
        self
    }

    /// Sets the value of [description][crate::model::Permission::description].
    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.description = v.into();
        self
    }

    /// Sets the value of [only_in_predefined_roles][crate::model::Permission::only_in_predefined_roles].
    #[deprecated]
    pub fn set_only_in_predefined_roles<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.only_in_predefined_roles = v.into();
        self
    }

    /// Sets the value of [stage][crate::model::Permission::stage].
    pub fn set_stage<T: std::convert::Into<crate::model::permission::PermissionLaunchStage>>(
        mut self,
        v: T,
    ) -> Self {
        self.stage = v.into();
        self
    }

    /// Sets the value of [custom_roles_support_level][crate::model::Permission::custom_roles_support_level].
    pub fn set_custom_roles_support_level<
        T: std::convert::Into<crate::model::permission::CustomRolesSupportLevel>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.custom_roles_support_level = v.into();
        self
    }

    /// Sets the value of [api_disabled][crate::model::Permission::api_disabled].
    pub fn set_api_disabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.api_disabled = v.into();
        self
    }

    /// Sets the value of [primary_permission][crate::model::Permission::primary_permission].
    pub fn set_primary_permission<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.primary_permission = v.into();
        self
    }
}

impl wkt::message::Message for Permission {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.Permission"
    }
}

/// Defines additional types related to [Permission].
pub mod permission {
    #[allow(unused_imports)]
    use super::*;

    /// A stage representing a permission's lifecycle phase.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum PermissionLaunchStage {
        /// The permission is currently in an alpha phase.
        Alpha,
        /// The permission is currently in a beta phase.
        Beta,
        /// The permission is generally available.
        Ga,
        /// The permission is being deprecated.
        Deprecated,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [PermissionLaunchStage::value] or
        /// [PermissionLaunchStage::name].
        UnknownValue(permission_launch_stage::UnknownValue),
    }

    #[doc(hidden)]
    pub mod permission_launch_stage {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl PermissionLaunchStage {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Alpha => std::option::Option::Some(0),
                Self::Beta => std::option::Option::Some(1),
                Self::Ga => std::option::Option::Some(2),
                Self::Deprecated => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Alpha => std::option::Option::Some("ALPHA"),
                Self::Beta => std::option::Option::Some("BETA"),
                Self::Ga => std::option::Option::Some("GA"),
                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for PermissionLaunchStage {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for PermissionLaunchStage {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for PermissionLaunchStage {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Alpha,
                1 => Self::Beta,
                2 => Self::Ga,
                3 => Self::Deprecated,
                _ => Self::UnknownValue(permission_launch_stage::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for PermissionLaunchStage {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "ALPHA" => Self::Alpha,
                "BETA" => Self::Beta,
                "GA" => Self::Ga,
                "DEPRECATED" => Self::Deprecated,
                _ => Self::UnknownValue(permission_launch_stage::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for PermissionLaunchStage {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Alpha => serializer.serialize_i32(0),
                Self::Beta => serializer.serialize_i32(1),
                Self::Ga => serializer.serialize_i32(2),
                Self::Deprecated => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for PermissionLaunchStage {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PermissionLaunchStage>::new(
                ".google.iam.admin.v1.Permission.PermissionLaunchStage",
            ))
        }
    }

    /// The state of the permission with regards to custom roles.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum CustomRolesSupportLevel {
        /// Default state. Permission is fully supported for custom role use.
        Supported,
        /// Permission is being tested to check custom role compatibility.
        Testing,
        /// Permission is not supported for custom role use.
        NotSupported,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [CustomRolesSupportLevel::value] or
        /// [CustomRolesSupportLevel::name].
        UnknownValue(custom_roles_support_level::UnknownValue),
    }

    #[doc(hidden)]
    pub mod custom_roles_support_level {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl CustomRolesSupportLevel {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Supported => std::option::Option::Some(0),
                Self::Testing => std::option::Option::Some(1),
                Self::NotSupported => std::option::Option::Some(2),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Supported => std::option::Option::Some("SUPPORTED"),
                Self::Testing => std::option::Option::Some("TESTING"),
                Self::NotSupported => std::option::Option::Some("NOT_SUPPORTED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for CustomRolesSupportLevel {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for CustomRolesSupportLevel {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for CustomRolesSupportLevel {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Supported,
                1 => Self::Testing,
                2 => Self::NotSupported,
                _ => Self::UnknownValue(custom_roles_support_level::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for CustomRolesSupportLevel {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "SUPPORTED" => Self::Supported,
                "TESTING" => Self::Testing,
                "NOT_SUPPORTED" => Self::NotSupported,
                _ => Self::UnknownValue(custom_roles_support_level::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for CustomRolesSupportLevel {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Supported => serializer.serialize_i32(0),
                Self::Testing => serializer.serialize_i32(1),
                Self::NotSupported => serializer.serialize_i32(2),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for CustomRolesSupportLevel {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(
                wkt::internal::EnumVisitor::<CustomRolesSupportLevel>::new(
                    ".google.iam.admin.v1.Permission.CustomRolesSupportLevel",
                ),
            )
        }
    }
}

/// A request to get permissions which can be tested on a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryTestablePermissionsRequest {
    /// Required. The full resource name to query from the list of testable
    /// permissions.
    ///
    /// The name follows the Google Cloud Platform resource format.
    /// For example, a Cloud Platform project with id `my-project` will be named
    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
    pub full_resource_name: std::string::String,

    /// Optional limit on the number of permissions to include in the response.
    ///
    /// The default is 100, and the maximum is 1,000.
    pub page_size: i32,

    /// Optional pagination token returned in an earlier
    /// QueryTestablePermissionsRequest.
    pub page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryTestablePermissionsRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [full_resource_name][crate::model::QueryTestablePermissionsRequest::full_resource_name].
    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.full_resource_name = v.into();
        self
    }

    /// Sets the value of [page_size][crate::model::QueryTestablePermissionsRequest::page_size].
    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.page_size = v.into();
        self
    }

    /// Sets the value of [page_token][crate::model::QueryTestablePermissionsRequest::page_token].
    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.page_token = v.into();
        self
    }
}

impl wkt::message::Message for QueryTestablePermissionsRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.QueryTestablePermissionsRequest"
    }
}

/// The response containing permissions which can be tested on a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryTestablePermissionsResponse {
    /// The Permissions testable on the requested resource.
    pub permissions: std::vec::Vec<crate::model::Permission>,

    /// To retrieve the next page of results, set
    /// `QueryTestableRolesRequest.page_token` to this value.
    pub next_page_token: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryTestablePermissionsResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [permissions][crate::model::QueryTestablePermissionsResponse::permissions].
    pub fn set_permissions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::Permission>,
    {
        use std::iter::Iterator;
        self.permissions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [next_page_token][crate::model::QueryTestablePermissionsResponse::next_page_token].
    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.next_page_token = v.into();
        self
    }
}

impl wkt::message::Message for QueryTestablePermissionsResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.QueryTestablePermissionsResponse"
    }
}

#[doc(hidden)]
impl gax::paginator::internal::PageableResponse for QueryTestablePermissionsResponse {
    type PageItem = crate::model::Permission;

    fn items(self) -> std::vec::Vec<Self::PageItem> {
        self.permissions
    }

    fn next_page_token(&self) -> std::string::String {
        use std::clone::Clone;
        self.next_page_token.clone()
    }
}

/// A request to get the list of auditable services for a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryAuditableServicesRequest {
    /// Required. The full resource name to query from the list of auditable
    /// services.
    ///
    /// The name follows the Google Cloud Platform resource format.
    /// For example, a Cloud Platform project with id `my-project` will be named
    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
    pub full_resource_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryAuditableServicesRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [full_resource_name][crate::model::QueryAuditableServicesRequest::full_resource_name].
    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.full_resource_name = v.into();
        self
    }
}

impl wkt::message::Message for QueryAuditableServicesRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.QueryAuditableServicesRequest"
    }
}

/// A response containing a list of auditable services for a resource.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QueryAuditableServicesResponse {
    /// The auditable services for a resource.
    pub services: std::vec::Vec<crate::model::query_auditable_services_response::AuditableService>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl QueryAuditableServicesResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [services][crate::model::QueryAuditableServicesResponse::services].
    pub fn set_services<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::query_auditable_services_response::AuditableService>,
    {
        use std::iter::Iterator;
        self.services = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for QueryAuditableServicesResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.QueryAuditableServicesResponse"
    }
}

/// Defines additional types related to [QueryAuditableServicesResponse].
pub mod query_auditable_services_response {
    #[allow(unused_imports)]
    use super::*;

    /// Contains information about an auditable service.
    #[derive(Clone, Default, PartialEq)]
    #[non_exhaustive]
    pub struct AuditableService {
        /// Public name of the service.
        /// For example, the service name for Cloud IAM is 'iam.googleapis.com'.
        pub name: std::string::String,

        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
    }

    impl AuditableService {
        pub fn new() -> Self {
            std::default::Default::default()
        }

        /// Sets the value of [name][crate::model::query_auditable_services_response::AuditableService::name].
        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
            self.name = v.into();
            self
        }
    }

    impl wkt::message::Message for AuditableService {
        fn typename() -> &'static str {
            "type.googleapis.com/google.iam.admin.v1.QueryAuditableServicesResponse.AuditableService"
        }
    }
}

/// The request to lint a Cloud IAM policy object.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LintPolicyRequest {
    /// The full resource name of the policy this lint request is about.
    ///
    /// The name follows the Google Cloud Platform (GCP) resource format.
    /// For example, a GCP project with ID `my-project` will be named
    /// `//cloudresourcemanager.googleapis.com/projects/my-project`.
    ///
    /// The resource name is not used to read the policy instance from the Cloud
    /// IAM database. The candidate policy for lint has to be provided in the same
    /// request object.
    pub full_resource_name: std::string::String,

    /// Required. The Cloud IAM object to be linted.
    pub lint_object: std::option::Option<crate::model::lint_policy_request::LintObject>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LintPolicyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [full_resource_name][crate::model::LintPolicyRequest::full_resource_name].
    pub fn set_full_resource_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.full_resource_name = v.into();
        self
    }

    /// Sets the value of [lint_object][crate::model::LintPolicyRequest::lint_object].
    ///
    /// Note that all the setters affecting `lint_object` are mutually
    /// exclusive.
    pub fn set_lint_object<
        T: std::convert::Into<std::option::Option<crate::model::lint_policy_request::LintObject>>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.lint_object = v.into();
        self
    }

    /// The value of [lint_object][crate::model::LintPolicyRequest::lint_object]
    /// if it holds a `Condition`, `None` if the field is not set or
    /// holds a different branch.
    pub fn condition(&self) -> std::option::Option<&std::boxed::Box<gtype::model::Expr>> {
        #[allow(unreachable_patterns)]
        self.lint_object.as_ref().and_then(|v| match v {
            crate::model::lint_policy_request::LintObject::Condition(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [lint_object][crate::model::LintPolicyRequest::lint_object]
    /// to hold a `Condition`.
    ///
    /// Note that all the setters affecting `lint_object` are
    /// mutually exclusive.
    pub fn set_condition<T: std::convert::Into<std::boxed::Box<gtype::model::Expr>>>(
        mut self,
        v: T,
    ) -> Self {
        self.lint_object = std::option::Option::Some(
            crate::model::lint_policy_request::LintObject::Condition(v.into()),
        );
        self
    }
}

impl wkt::message::Message for LintPolicyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.LintPolicyRequest"
    }
}

/// Defines additional types related to [LintPolicyRequest].
pub mod lint_policy_request {
    #[allow(unused_imports)]
    use super::*;

    /// Required. The Cloud IAM object to be linted.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum LintObject {
        /// [google.iam.v1.Binding.condition] [google.iam.v1.Binding.condition] object to be linted.
        Condition(std::boxed::Box<gtype::model::Expr>),
    }
}

/// Structured response of a single validation unit.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LintResult {
    /// The validation unit level.
    pub level: crate::model::lint_result::Level,

    /// The validation unit name, for instance
    /// "lintValidationUnits/ConditionComplexityCheck".
    pub validation_unit_name: std::string::String,

    /// The validation unit severity.
    pub severity: crate::model::lint_result::Severity,

    /// The name of the field for which this lint result is about.
    ///
    /// For nested messages `field_name` consists of names of the embedded fields
    /// separated by period character. The top-level qualifier is the input object
    /// to lint in the request. For example, the `field_name` value
    /// `condition.expression` identifies a lint result for the `expression` field
    /// of the provided condition.
    pub field_name: std::string::String,

    /// 0-based character position of problematic construct within the object
    /// identified by `field_name`. Currently, this is populated only for condition
    /// expression.
    pub location_offset: i32,

    /// Human readable debug message associated with the issue.
    pub debug_message: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LintResult {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [level][crate::model::LintResult::level].
    pub fn set_level<T: std::convert::Into<crate::model::lint_result::Level>>(
        mut self,
        v: T,
    ) -> Self {
        self.level = v.into();
        self
    }

    /// Sets the value of [validation_unit_name][crate::model::LintResult::validation_unit_name].
    pub fn set_validation_unit_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.validation_unit_name = v.into();
        self
    }

    /// Sets the value of [severity][crate::model::LintResult::severity].
    pub fn set_severity<T: std::convert::Into<crate::model::lint_result::Severity>>(
        mut self,
        v: T,
    ) -> Self {
        self.severity = v.into();
        self
    }

    /// Sets the value of [field_name][crate::model::LintResult::field_name].
    pub fn set_field_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.field_name = v.into();
        self
    }

    /// Sets the value of [location_offset][crate::model::LintResult::location_offset].
    pub fn set_location_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
        self.location_offset = v.into();
        self
    }

    /// Sets the value of [debug_message][crate::model::LintResult::debug_message].
    pub fn set_debug_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.debug_message = v.into();
        self
    }
}

impl wkt::message::Message for LintResult {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.LintResult"
    }
}

/// Defines additional types related to [LintResult].
pub mod lint_result {
    #[allow(unused_imports)]
    use super::*;

    /// Possible Level values of a validation unit corresponding to its domain
    /// of discourse.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Level {
        /// Level is unspecified.
        Unspecified,
        /// A validation unit which operates on an individual condition within a
        /// binding.
        Condition,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Level::value] or
        /// [Level::name].
        UnknownValue(level::UnknownValue),
    }

    #[doc(hidden)]
    pub mod level {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Level {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Condition => std::option::Option::Some(3),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("LEVEL_UNSPECIFIED"),
                Self::Condition => std::option::Option::Some("CONDITION"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Level {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Level {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Level {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                3 => Self::Condition,
                _ => Self::UnknownValue(level::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Level {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "LEVEL_UNSPECIFIED" => Self::Unspecified,
                "CONDITION" => Self::Condition,
                _ => Self::UnknownValue(level::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Level {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Condition => serializer.serialize_i32(3),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Level {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Level>::new(
                ".google.iam.admin.v1.LintResult.Level",
            ))
        }
    }

    /// Possible Severity values of an issued result.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum Severity {
        /// Severity is unspecified.
        Unspecified,
        /// A validation unit returns an error only for critical issues. If an
        /// attempt is made to set the problematic policy without rectifying the
        /// critical issue, it causes the `setPolicy` operation to fail.
        Error,
        /// Any issue which is severe enough but does not cause an error.
        /// For example, suspicious constructs in the input object will not
        /// necessarily fail `setPolicy`, but there is a high likelihood that they
        /// won't behave as expected during policy evaluation in `checkPolicy`.
        /// This includes the following common scenarios:
        ///
        /// - Unsatisfiable condition: Expired timestamp in date/time condition.
        /// - Ineffective condition: Condition on a <principal, role> pair which is
        ///   granted unconditionally in another binding of the same policy.
        Warning,
        /// Reserved for the issues that are not severe as `ERROR`/`WARNING`, but
        /// need special handling. For instance, messages about skipped validation
        /// units are issued as `NOTICE`.
        Notice,
        /// Any informative statement which is not severe enough to raise
        /// `ERROR`/`WARNING`/`NOTICE`, like auto-correction recommendations on the
        /// input content. Note that current version of the linter does not utilize
        /// `INFO`.
        Info,
        /// Deprecated severity level.
        Deprecated,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [Severity::value] or
        /// [Severity::name].
        UnknownValue(severity::UnknownValue),
    }

    #[doc(hidden)]
    pub mod severity {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl Severity {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::Error => std::option::Option::Some(1),
                Self::Warning => std::option::Option::Some(2),
                Self::Notice => std::option::Option::Some(3),
                Self::Info => std::option::Option::Some(4),
                Self::Deprecated => std::option::Option::Some(5),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
                Self::Error => std::option::Option::Some("ERROR"),
                Self::Warning => std::option::Option::Some("WARNING"),
                Self::Notice => std::option::Option::Some("NOTICE"),
                Self::Info => std::option::Option::Some("INFO"),
                Self::Deprecated => std::option::Option::Some("DEPRECATED"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for Severity {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for Severity {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for Severity {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::Error,
                2 => Self::Warning,
                3 => Self::Notice,
                4 => Self::Info,
                5 => Self::Deprecated,
                _ => Self::UnknownValue(severity::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for Severity {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
                "ERROR" => Self::Error,
                "WARNING" => Self::Warning,
                "NOTICE" => Self::Notice,
                "INFO" => Self::Info,
                "DEPRECATED" => Self::Deprecated,
                _ => Self::UnknownValue(severity::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for Severity {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::Error => serializer.serialize_i32(1),
                Self::Warning => serializer.serialize_i32(2),
                Self::Notice => serializer.serialize_i32(3),
                Self::Info => serializer.serialize_i32(4),
                Self::Deprecated => serializer.serialize_i32(5),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for Severity {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
                ".google.iam.admin.v1.LintResult.Severity",
            ))
        }
    }
}

/// The response of a lint operation. An empty response indicates
/// the operation was able to fully execute and no lint issue was found.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LintPolicyResponse {
    /// List of lint results sorted by `severity` in descending order.
    pub lint_results: std::vec::Vec<crate::model::LintResult>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LintPolicyResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [lint_results][crate::model::LintPolicyResponse::lint_results].
    pub fn set_lint_results<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::LintResult>,
    {
        use std::iter::Iterator;
        self.lint_results = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for LintPolicyResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.iam.admin.v1.LintPolicyResponse"
    }
}

/// Supported key algorithms.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ServiceAccountKeyAlgorithm {
    /// An unspecified key algorithm.
    KeyAlgUnspecified,
    /// 1k RSA Key.
    KeyAlgRsa1024,
    /// 2k RSA Key.
    KeyAlgRsa2048,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ServiceAccountKeyAlgorithm::value] or
    /// [ServiceAccountKeyAlgorithm::name].
    UnknownValue(service_account_key_algorithm::UnknownValue),
}

#[doc(hidden)]
pub mod service_account_key_algorithm {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ServiceAccountKeyAlgorithm {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::KeyAlgUnspecified => std::option::Option::Some(0),
            Self::KeyAlgRsa1024 => std::option::Option::Some(1),
            Self::KeyAlgRsa2048 => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::KeyAlgUnspecified => std::option::Option::Some("KEY_ALG_UNSPECIFIED"),
            Self::KeyAlgRsa1024 => std::option::Option::Some("KEY_ALG_RSA_1024"),
            Self::KeyAlgRsa2048 => std::option::Option::Some("KEY_ALG_RSA_2048"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ServiceAccountKeyAlgorithm {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ServiceAccountKeyAlgorithm {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ServiceAccountKeyAlgorithm {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::KeyAlgUnspecified,
            1 => Self::KeyAlgRsa1024,
            2 => Self::KeyAlgRsa2048,
            _ => Self::UnknownValue(service_account_key_algorithm::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ServiceAccountKeyAlgorithm {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "KEY_ALG_UNSPECIFIED" => Self::KeyAlgUnspecified,
            "KEY_ALG_RSA_1024" => Self::KeyAlgRsa1024,
            "KEY_ALG_RSA_2048" => Self::KeyAlgRsa2048,
            _ => Self::UnknownValue(service_account_key_algorithm::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ServiceAccountKeyAlgorithm {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::KeyAlgUnspecified => serializer.serialize_i32(0),
            Self::KeyAlgRsa1024 => serializer.serialize_i32(1),
            Self::KeyAlgRsa2048 => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ServiceAccountKeyAlgorithm {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(
            wkt::internal::EnumVisitor::<ServiceAccountKeyAlgorithm>::new(
                ".google.iam.admin.v1.ServiceAccountKeyAlgorithm",
            ),
        )
    }
}

/// Supported private key output formats.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ServiceAccountPrivateKeyType {
    /// Unspecified. Equivalent to `TYPE_GOOGLE_CREDENTIALS_FILE`.
    TypeUnspecified,
    /// PKCS12 format.
    /// The password for the PKCS12 file is `notasecret`.
    /// For more information, see <https://tools.ietf.org/html/rfc7292>.
    TypePkcs12File,
    /// Google Credentials File format.
    TypeGoogleCredentialsFile,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ServiceAccountPrivateKeyType::value] or
    /// [ServiceAccountPrivateKeyType::name].
    UnknownValue(service_account_private_key_type::UnknownValue),
}

#[doc(hidden)]
pub mod service_account_private_key_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ServiceAccountPrivateKeyType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::TypeUnspecified => std::option::Option::Some(0),
            Self::TypePkcs12File => std::option::Option::Some(1),
            Self::TypeGoogleCredentialsFile => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::TypeUnspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
            Self::TypePkcs12File => std::option::Option::Some("TYPE_PKCS12_FILE"),
            Self::TypeGoogleCredentialsFile => {
                std::option::Option::Some("TYPE_GOOGLE_CREDENTIALS_FILE")
            }
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ServiceAccountPrivateKeyType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ServiceAccountPrivateKeyType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ServiceAccountPrivateKeyType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::TypeUnspecified,
            1 => Self::TypePkcs12File,
            2 => Self::TypeGoogleCredentialsFile,
            _ => Self::UnknownValue(service_account_private_key_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ServiceAccountPrivateKeyType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "TYPE_UNSPECIFIED" => Self::TypeUnspecified,
            "TYPE_PKCS12_FILE" => Self::TypePkcs12File,
            "TYPE_GOOGLE_CREDENTIALS_FILE" => Self::TypeGoogleCredentialsFile,
            _ => Self::UnknownValue(service_account_private_key_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ServiceAccountPrivateKeyType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::TypeUnspecified => serializer.serialize_i32(0),
            Self::TypePkcs12File => serializer.serialize_i32(1),
            Self::TypeGoogleCredentialsFile => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ServiceAccountPrivateKeyType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(
            wkt::internal::EnumVisitor::<ServiceAccountPrivateKeyType>::new(
                ".google.iam.admin.v1.ServiceAccountPrivateKeyType",
            ),
        )
    }
}

/// Supported public key output formats.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ServiceAccountPublicKeyType {
    /// Do not return the public key.
    TypeNone,
    /// X509 PEM format.
    TypeX509PemFile,
    /// Raw public key.
    TypeRawPublicKey,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ServiceAccountPublicKeyType::value] or
    /// [ServiceAccountPublicKeyType::name].
    UnknownValue(service_account_public_key_type::UnknownValue),
}

#[doc(hidden)]
pub mod service_account_public_key_type {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ServiceAccountPublicKeyType {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::TypeNone => std::option::Option::Some(0),
            Self::TypeX509PemFile => std::option::Option::Some(1),
            Self::TypeRawPublicKey => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::TypeNone => std::option::Option::Some("TYPE_NONE"),
            Self::TypeX509PemFile => std::option::Option::Some("TYPE_X509_PEM_FILE"),
            Self::TypeRawPublicKey => std::option::Option::Some("TYPE_RAW_PUBLIC_KEY"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ServiceAccountPublicKeyType {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ServiceAccountPublicKeyType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ServiceAccountPublicKeyType {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::TypeNone,
            1 => Self::TypeX509PemFile,
            2 => Self::TypeRawPublicKey,
            _ => Self::UnknownValue(service_account_public_key_type::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ServiceAccountPublicKeyType {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "TYPE_NONE" => Self::TypeNone,
            "TYPE_X509_PEM_FILE" => Self::TypeX509PemFile,
            "TYPE_RAW_PUBLIC_KEY" => Self::TypeRawPublicKey,
            _ => Self::UnknownValue(service_account_public_key_type::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ServiceAccountPublicKeyType {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::TypeNone => serializer.serialize_i32(0),
            Self::TypeX509PemFile => serializer.serialize_i32(1),
            Self::TypeRawPublicKey => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ServiceAccountPublicKeyType {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(
            wkt::internal::EnumVisitor::<ServiceAccountPublicKeyType>::new(
                ".google.iam.admin.v1.ServiceAccountPublicKeyType",
            ),
        )
    }
}

/// Service Account Key Origin.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ServiceAccountKeyOrigin {
    /// Unspecified key origin.
    OriginUnspecified,
    /// Key is provided by user.
    UserProvided,
    /// Key is provided by Google.
    GoogleProvided,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [ServiceAccountKeyOrigin::value] or
    /// [ServiceAccountKeyOrigin::name].
    UnknownValue(service_account_key_origin::UnknownValue),
}

#[doc(hidden)]
pub mod service_account_key_origin {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl ServiceAccountKeyOrigin {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::OriginUnspecified => std::option::Option::Some(0),
            Self::UserProvided => std::option::Option::Some(1),
            Self::GoogleProvided => std::option::Option::Some(2),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::OriginUnspecified => std::option::Option::Some("ORIGIN_UNSPECIFIED"),
            Self::UserProvided => std::option::Option::Some("USER_PROVIDED"),
            Self::GoogleProvided => std::option::Option::Some("GOOGLE_PROVIDED"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for ServiceAccountKeyOrigin {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for ServiceAccountKeyOrigin {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for ServiceAccountKeyOrigin {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::OriginUnspecified,
            1 => Self::UserProvided,
            2 => Self::GoogleProvided,
            _ => Self::UnknownValue(service_account_key_origin::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for ServiceAccountKeyOrigin {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "ORIGIN_UNSPECIFIED" => Self::OriginUnspecified,
            "USER_PROVIDED" => Self::UserProvided,
            "GOOGLE_PROVIDED" => Self::GoogleProvided,
            _ => Self::UnknownValue(service_account_key_origin::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for ServiceAccountKeyOrigin {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::OriginUnspecified => serializer.serialize_i32(0),
            Self::UserProvided => serializer.serialize_i32(1),
            Self::GoogleProvided => serializer.serialize_i32(2),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for ServiceAccountKeyOrigin {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServiceAccountKeyOrigin>::new(
            ".google.iam.admin.v1.ServiceAccountKeyOrigin",
        ))
    }
}

/// A view for Role objects.
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum RoleView {
    /// Omits the `included_permissions` field.
    /// This is the default value.
    Basic,
    /// Returns all fields.
    Full,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [RoleView::value] or
    /// [RoleView::name].
    UnknownValue(role_view::UnknownValue),
}

#[doc(hidden)]
pub mod role_view {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl RoleView {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Basic => std::option::Option::Some(0),
            Self::Full => std::option::Option::Some(1),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Basic => std::option::Option::Some("BASIC"),
            Self::Full => std::option::Option::Some("FULL"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for RoleView {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for RoleView {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for RoleView {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Basic,
            1 => Self::Full,
            _ => Self::UnknownValue(role_view::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for RoleView {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "BASIC" => Self::Basic,
            "FULL" => Self::Full,
            _ => Self::UnknownValue(role_view::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for RoleView {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Basic => serializer.serialize_i32(0),
            Self::Full => serializer.serialize_i32(1),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for RoleView {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<RoleView>::new(
            ".google.iam.admin.v1.RoleView",
        ))
    }
}
